{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=1590
  Verdict: Accepted
}
uses
	SysUtils, Math;
 
var 
	i,j,k,kk,n,m,ii:longint;
	a:array[0..110,0..110] of longint;
	f:boolean;
 
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
read(n,m,k);
for i:=1 to n do
	for j:=1 to m do 
		read(a[i][j]);
for i:=1 to n do begin
	kk:=m-k+1;
	for j:=1 to kk do begin    
		f:=true;
		for ii:=1 to k do
			if a[i][j+ii-1]<>0 then begin
				f:=false;
				break;
			end;
		if f then break;
	end;
	if f then break;
end;
if f then write('YES') else write('NO');
end.